From: Jonas Dreßler Date: Thu, 31 Jul 2025 09:43:57 +0000 (+0200) Subject: Set event phase to CAPTURE for swipe gestures starting in the session X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~104^2^2~41 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=a3b6931603db8ce3a95de78ad9c9e0aa71de3605;p=gnome-shell.git Set event phase to CAPTURE for swipe gestures starting in the session When a swipe gesture can get triggered in the session (ie. on top of a window, not just from the overview or other shell chrome), we want it to receive events as soon as possible, as otherwise the clients will see those events. So use the CAPTURE phase for the overview gesture and the workspace switching gesture, which makes sure the gesture sees each event before a window gets to see it. Part-of: --- diff --git a/js/ui/overview.js b/js/ui/overview.js index cb0bf22f3..5dbd181de 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -231,7 +231,11 @@ export class Overview extends Signals.EventEmitter { const swipeTracker = new SwipeTracker.SwipeTracker(global.stage, Clutter.Orientation.VERTICAL, Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW, - {allowDrag: false, allowScroll: false}); + { + allowDrag: false, + allowScroll: false, + phase: Clutter.EventPhase.CAPTURE, + }); swipeTracker.orientation = Clutter.Orientation.VERTICAL; swipeTracker.connect('begin', this._gestureBegin.bind(this)); swipeTracker.connect('update', this._gestureUpdate.bind(this)); diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 4720ee10f..a911d034a 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -366,8 +366,13 @@ export const SwipeTracker = GObject.registerClass({ }, }, class SwipeTracker extends GObject.Object { _init(actor, orientation, allowedModes, params) { + params = Params.parse(params, { + allowDrag: true, + allowScroll: true, + phase: Clutter.EventPhase.BUBBLE, + }); + super._init(); - params = Params.parse(params, {allowDrag: true, allowScroll: true}); this.orientation = orientation; this._allowedModes = allowedModes; @@ -397,7 +402,7 @@ export const SwipeTracker = GObject.registerClass({ ? Clutter.PanAxis.X : Clutter.PanAxis.Y, ], null); - actor.add_action_full("SwipeTracker", Clutter.EventPhase.BUBBLE, this._panGesture); + actor.add_action_full('SwipeTracker', params.phase, this._panGesture); this._touchpadGesture = new TouchpadSwipeGesture(allowedModes); this._touchpadGesture.connect('begin', this._beginTouchpadGesture.bind(this)); diff --git a/js/ui/workspaceAnimation.js b/js/ui/workspaceAnimation.js index e318b0e09..70e24fb45 100644 --- a/js/ui/workspaceAnimation.js +++ b/js/ui/workspaceAnimation.js @@ -329,7 +329,10 @@ export class WorkspaceAnimationController { const swipeTracker = new SwipeTracker.SwipeTracker(global.stage, Clutter.Orientation.HORIZONTAL, Shell.ActionMode.NORMAL, - {allowDrag: false}); + { + allowDrag: false, + phase: Clutter.EventPhase.CAPTURE, + }); swipeTracker.connect('begin', this._switchWorkspaceBegin.bind(this)); swipeTracker.connect('update', this._switchWorkspaceUpdate.bind(this)); swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));